<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>产品信息</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<!-- easyui -->
<link rel="stylesheet" type="text/css" href="/_resources/easyui/themes/default/easyui.css">
<link rel="stylesheet" type="text/css" href="/_resources/easyui/themes/icon.css">
<link rel="stylesheet" type="text/css" href="/_resources/easyui/themes/extIcon.css">
<link rel="stylesheet" type="text/css" href="/_resources/easyui/demo/demo.css">
<script type="text/javascript" src="/_resources/easyui/jquery.min.js"></script>
<script type="text/javascript" src="/_resources/easyui/jquery.easyui.min.js"></script>
<script type="text/javascript" src="/_resources/easyui/jquery.edatagrid.js"></script>
<script type="text/javascript" src="/_resources/js/jqueryUtils.js"></script>
<script type="text/javascript" src="/_resources/js/date.js"></script>
<script type="text/javascript" src="/_resources/My97DatePicker/WdatePicker.js"></script>
<script language='javascript'>
	function jsSave() {
		var params =  $.serializeObject($('#form1'));
		
		if(params.name == ''){
			$.messager.alert('提醒信息','产品名称不能为空');
			return;
		}
		
		$.ajax({
		  type: 'POST',
		  url: "save.do" ,
		  data: params,
		  dataType: "json",
		  error:function(){
		  	$('#form1').find("input[name=savingFlag]").val('');
		  	alert('系统异常'); 
		  },
		  success: function(json){
		  	$('#form1').find("input[name=savingFlag]").val('');
		  	if(json.errorCode == 200){
		  		$('#id').val(json.data.id);
		  		
		  		$.messager.show({title: '提醒信息', msg: '保存成功'});
		  	}else{
		  		$.messager.show({title: '提醒信息', msg: '保存失败-' + json.moreInfo});
		  	}
		  }
		});
	}
</script>
</head>
<body style='margin-top:10px;margin-bottom:20px'>

<div align="left">
<form method="post" name="form1" id="form1">

<table>
	<tr>
		<td style="width:120px"></td>
		<td style="width:560px"></td>
	</tr>
	<tr>
		<td></td>
		<td><strong>产品信息编辑</strong></td>
	</tr>
	<tr>
		<td></td>
		<td>
			<a href='javascript:void(0)' onclick='jsSave();' class="easyui-linkbutton" data-options="iconCls:'icon-save'">保存</a>
			<input type='hidden' id='id'     name='id' value="${product.id}" />
			<input type='hidden' id='savingFlag' name='savingFlag'/> <!-- 是否正在保存 -->
		</td>
	</tr>
	<tr>	
		<td style="text-align:right">产品图片</td>
		<td>
			<img src='http://${oss_bucketName}.${oss_endpoint}/${product.image1}?x-oss-process=image/resize,h_90' />
		</td>
	</tr>
	<tr>	
		<td style="text-align:right">产品编号</td>
		<td>
			<input type='text' name="no" value="${product.no}" style='width:300px' readonly/>
		</td>
	</tr>
	<tr>	
		<td style="text-align:right">中文描述</td>
		<td>
			<input type='text' name="desc_cn" style='width:300px' value="${product.desc_cn}" />
		</td>
	</tr>
	<tr>	
		<td style="text-align:right">英文描述</td>
		<td>
			<input type='text' name="desc_en" style='width:300px' value="${product.desc_en}" />
		</td>
	</tr>
	<tr>	
		<td style="text-align:right">产品特色</td>
		<td>
			<textarea name="features" style='width:302px;height:50px'>${product.features}</textarea>
		</td>
	</tr>
	<tr>	
		<td style="text-align:right">产品类别</td>
		<td>
			<select name="catId">
				<option value=''>请选择</option>
			<c:forEach var="item" items="${lsCategory}">
				<option value='${item.id}' <c:if test= "${item.id == product.catId}" >selected</c:if> >${item.name}(${item.code})</option>
            </c:forEach>
			</select>
		</td>
	</tr>
	<tr>	
		<td style="text-align:right">产品尺寸</td>
		<td>
			<input type='text' name="size" style='width:300px' value="${product.size}" />
		</td>
	</tr>
	<tr>	
		<td style="text-align:right">产品重量</td>
		<td>
			<input type='text' name="weight" style='width:300px' value="${product.weight}" />
		</td>
	</tr>
	<tr>	
		<td style="text-align:right">最小订货量</td>
		<td>
			<input type='text' name="minBookAmount" style='width:300px' value="${product.minBookAmount}" />
		</td>
	</tr>
	<tr>	
		<td style="text-align:right">交货期</td>
		<td>
			<input type='text' name="deliveryTime" style='width:300px' value="${product.deliveryTime}" />
		</td>
	</tr>
	<tr>	
		<td style="text-align:right">供应商单位名称</td>
		<td>
			<input type='text' name="supplierName" style='width:300px' value="${product.supplierName}" />
		</td>
	</tr>
	<tr>	
		<td style="text-align:right">工厂价格</td>
		<td>
			<input type='text' name="factoryPrice" style='width:300px' value="${product.factoryPrice}" />
		</td>
	</tr>
	<tr>	
		<td style="text-align:right">包装箱尺寸</td>
		<td>
			<input type='text' name="packageSize" style='width:300px' value="${product.packageSize}" />
		</td>
	</tr>
	<tr>	
		<td style="text-align:right">包装数量</td>
		<td>
			<input type='text' name="packageAmount" style='width:300px' value="${product.packageAmount}" />
		</td>
	</tr>
	<tr>	
		<td style="text-align:right">包装箱重量</td>
		<td>
			<input type='text' name="packageWeight" style='width:300px' value="${product.packageWeight}" />
		</td>
	</tr>
	<tr>	
		<td style="text-align:right">包装箱重量</td>
		<td>
			<input type='text' name="imageSource" style='width:300px' value="${product.imageSource}" />
		</td>
	</tr>
	<tr>	
		<td style="text-align:right">备注</td>
		<td>
			<textarea name="memo" style='width:302px;height:60px'>${product.memo}</textarea>
		</td>
	</tr>
</table>
</form>
</div>
<style type="text/css">
*{margin:0px; padding:0px;}
.dn{display:none;}
.chackTextarea-area{line-height:22px; font-size:14px; padding:1px 5px; border:1px solid #CDCDCD; width:630px; height:40px;}
.content{width:420px; margin:0 auto; padding-top:20px;}
.content h1{font-size:16px; font-family:微软雅黑; font-weight:normal;}
</style>

</body>
</html>
